GString *string,
guint indent)
{
- GtkCssNode *node;
+ gboolean need_newline = FALSE;
g_string_append_printf (string, "%*s", indent, "");
g_string_append_c (string, '\n');
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE)
- gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE);
+ need_newline = gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE);
if (flags & GTK_STYLE_CONTEXT_PRINT_RECURSE)
{
+ GtkCssNode *node;
+
+ if (need_newline && gtk_css_node_get_first_child (cssnode))
+ g_string_append_c (string, '\n');
+
for (node = gtk_css_node_get_first_child (cssnode); node; node = gtk_css_node_get_next_sibling (node))
gtk_css_node_print (node, flags, string, indent + 2);
}
return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style);
}
-void
+/*
+ * gtk_css_style_print:
+ * @style: a #GtkCssStyle
+ * @string: the #GString to print to
+ * @indent: level of indentation to use
+ * @skip_initial: %TRUE to skip properties that have their initial value
+ *
+ * Print the @style to @string, in CSS format. Every property is printed
+ * on a line by itself, indented by @indent spaces. If @skip_initial is
+ * %TRUE, properties are only printed if their value in @style is different
+ * from the initial value of the property.
+ *
+ * Returns: %TRUE is any properties have been printed
+ */
+gboolean
gtk_css_style_print (GtkCssStyle *style,
GString *string,
guint indent,
gboolean skip_initial)
{
guint i;
+ gboolean retval = FALSE;
g_return_if_fail (GTK_IS_CSS_STYLE (style));
g_return_if_fail (string != NULL);
}
g_string_append_c (string, '\n');
+
+ retval = TRUE;
}
+
+ return retval;
}
char *
gboolean gtk_css_style_is_static (GtkCssStyle *style);
char * gtk_css_style_to_string (GtkCssStyle *style);
-void gtk_css_style_print (GtkCssStyle *style,
+gboolean gtk_css_style_print (GtkCssStyle *style,
GString *string,
guint indent,
gboolean skip_initial);